package cn.hengzhu.main_manager.utils;

import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;


//对str进行sha1的加密
public class SecurityUtil {

	public static String sha1(String str) {
		str=str+"skd.ohsiu9^%1";
		try {
			StringBuilder sb = new StringBuilder();
			MessageDigest digest = MessageDigest.getInstance("sha1");
			// 放入加密字符串
			digest.update(str.getBytes());
			// 进行加密
			byte[] digestMsg = digest.digest();
			// byte转换16进制
			for (byte b : digestMsg) {
				sb.append(String.format("%02x", b));
			}
			return sb.toString();
		} catch (NoSuchAlgorithmException e) {
			e.printStackTrace();
		}
		return str;
	}
}

